#ifndef VIDEOTHREAD_H
#define VIDEOTHREAD_H

#include <QThread>
#include <list>
#include "decoder.h"

struct AVPacket;
struct AVCodecParameters;

class VideoThread : public QThread
{
    Q_OBJECT
public:
    explicit VideoThread(QObject *parent = nullptr);
    ~VideoThread();

public:
    //打开，不管成功与否都清理
    bool openVideoDecoder(AVCodecParameters *codec_params,int width,int height);
    void addList(AVPacket *pkt);

protected:

    void run() override;

private:

    //最大队列
    int maxList = 100;
    bool exit_flag = false;
    std::list <AVPacket *> packs;
    std::mutex mux;
    Decoder* decoder = 0;

};

#endif // VIDEOTHREAD_H
